package com.lsa.letcode.the111.minDepthOfTheBt;

import static org.junit.Assert.*;

import java.io.IOException;

import org.junit.Test;

import com.lsa.letcode.common.LetCodeTestBase;
import com.lsa.letcode.common.TreeNode;
import com.lsa.letcode.common.TreeUtils;

public class MinDepthOfTheBt extends LetCodeTestBase {
	@Test
	public void test() throws Exception {
		test("oneNode.tgf", 1);
		test("test1.tgf", 5);
		test("test2.tgf", 9);
		test("sym2.tgf", 3);
		test("sym4.tgf", 3);
		test("sym5.tgf", 3);
	}

	private void test(String resName, int expected) throws IOException {
		Solution s = new Solution();
		TreeNode n = TreeUtils.fromTgf(this.getClass(), resName);
		assertEquals(expected, s.minDepth(n));
	}
}
